package com.borko.healthcare.persistence.hibernate.dao;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.borko.healthcare.entities.beans.PharmacistBean;
import com.borko.healthcare.entities.interfaces.Pharmacist;

public class PharmacistDAOImpl extends HibernateDaoSupport implements PharmacistDAO {
	
	private void createOrUpdate(Pharmacist pharmacist) {
		getHibernateTemplate().saveOrUpdate(pharmacist);
	}

	public void create(Pharmacist pharmacist) {
		createOrUpdate(pharmacist);
	}

	public void delete(Pharmacist pharmacist) {
		getHibernateTemplate().delete(pharmacist);
	}

	public List<Pharmacist> retrive() {
		return getHibernateTemplate().loadAll(Pharmacist.class);
	}

	public void update(Pharmacist pharmacist) {
		getHibernateTemplate().saveOrUpdate(pharmacist);
	}
	
	public Pharmacist getPharmacist(int id) {
		return getHibernateTemplate().get(PharmacistBean.class, id);
	}

}
